Convert a String in a List¶
S.split(‘ ‘)
Convert a string in a list.
S = "The quick brown fox jumps over the lazy dog."
print(S.split(' '))
S = "The-quick-brown-fox-jumps-over-the-lazy-dog."
print(S.split('-'))
Output:
['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog.']
['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog.']